package com.cloudm.technician.ui.modules.common.register

import android.os.Bundle
import com.cloudm.technician.R
import com.cloudm.technician.extensions.addFragmentToActivity
import com.cloudm.technician.ui.base.BaseActivity

/**
 * 作者: wesley
 * 时间: 2017/12/14
 * 描述: 注册界面
 */
class RegisterActivity : BaseActivity(), RegisterFragment.OnTitleReceiveListener {

    private var flag: Int = 0 //0： 注册 1：忘记密码

    override val optionsMenuEnabled: Boolean
        get() = false

    override fun handleBundle(bundle: Bundle) {
        flag = bundle.getInt("flag")
    }

    override fun initVariables() {

    }

    override fun initViews(savedInstanceState: Bundle?) {
        val fragment = manager.findFragmentById(
                R.id.common_content) as? RegisterFragment ?: RegisterFragment.newInstance(flag)
        fragment.listener = this
        addFragmentToActivity(manager, fragment)
    }

    override fun initListener() {

    }

    override fun onTitleReceive(title: String?) {
        headerTitleString = title
        displayHomeAsUpEnabled = true
    }

}